<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script type="text/javascript">
	function checkForm() {
		var friendLinkTitle = document.getElementById("friendLinkTitle").value;
		var friendLinkUrl = document.getElementById("friendLinkUrl").value;
		if (friendLinkTitle == null || friendLinkTitle == ""
				|| friendLinkUrl == null || friendLinkUrl == "") {
			document.getElementById("error").innerHTML = "标题地址不能为空！";
			return false;
		}
		return true;
	}
</script>
<div class="data_list">
	<div class="data_list_title">
		<c:choose>
			<c:when test="${friendLink.id!=null }">
				<img
					src="${pageContext.request.contextPath}/image/icon/diary_type_edit_icon.png" />
				修改友链
			</c:when>
			<c:otherwise>
				<img
					src="${pageContext.request.contextPath}/image/icon/diaryType_add_icon.png" />
				添加友链
			</c:otherwise>
		</c:choose>
	</div>
	<form action="friendLinkManage?action=save" method="post"
		onsubmit="return checkForm()">
		<div class="friendLink_form">
			<input type="hidden" id="friendLinkId" name="friendLinkId"
				value="${friendLink.id }" />
			<table align="center">
				<tr>
					<td>友链标题：</td>
					<td><input type="text" id="friendLinkTitle"
						name="friendLinkTitle" value="${friendLink.title }"
						style="margin-top: 5px; height: 30px;" /></td>
				</tr>
				<tr>
					<td>友链地址：</td>
					<td><input type="url" id="friendLinkUrl" name="friendLinkUrl"
						value="${friendLink.url }" style="margin-top: 5px; height: 30px;" /></td>
				</tr>
				<tr>
					<td><input type="submit" class="btn btn-primary" value="保存" /></td>
					<td><button class="btn btn-primary" type="button"
							onclick="javascript:history.back()">返回</button>&nbsp;&nbsp;<font
						id="error" color="red">${error }</font></td>
				</tr>
			</table>
		</div>
	</form>
</div>
